package com.ying.tests.mongo.controller;

import com.ying.common.entity.Response;
import com.ying.tests.mongo.entity.Student;
import com.ying.tests.mongo.service.MongoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mongo")
public class MongoController {

    @Autowired
    private MongoService mongoService;

    @PostMapping("/insert")
    public Response insert(@RequestBody Student student) {
        return mongoService.insert(student);
    }

    @PostMapping("/select")
    public Response select(@RequestBody Student student) {
        return mongoService.select(student);
    }

}
